﻿@using NetCoreCMS.Common;
@using NetCoreCMS.Models;
@{
   Layout = "~/Areas/Admin/Views/Shared/_LayoutEdit.cshtml";
   ViewBag.Title = "nav_edit";
   List<SelectListItem> parentList = ViewData["selectListItems"] as List<SelectListItem>;
   Navigation m = ViewData["model"] as Navigation;
}
@section HeaderContent{
   <script>
      $(function () {
         //初始化表单验证
         $("#form1").initValidform();
         //初始化上传控件
         $(".upload-img").InitUploader({ sendurl: "/upload_ajax/index", swf: "/scripts/webuploader/uploader.swf" });
         if("@ViewBag.Action" == "@CMSEnums.ActionEnum.Edit.ToString()"){
            $("#txtName").attr("readonly", "readonly").focus();
            //$("#ddlParentId").attr("disabled", "disabled").addClass("aspNetDisabled");
         }
      });
   </script>
}
<form id="form1" method="post" action="SubmitSave?action=@ViewBag.Action&id=@ViewBag.Id">
<!--导航栏-->
<div class="location">
  <a href="../nav_list/index" class="back"><i class="iconfont icon-up"></i><span>返回列表页</span></a>
  <a href="../center/index"><i class="iconfont icon-home"></i><span>首页</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <a href="../nav_list/index"><span>导航列表</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>编辑后台导航</span>
  <div class="clipboard">
     <span><label id="clipMess"></label></span>
     <a href="javascript:;" class="copy" onclick="copy();"><i class="iconfont icon-copy"></i><span>复制</span></a>
     <a href="javascript:;" class="paste disable" onclick="paste();"><i class="iconfont icon-log"></i><span>粘贴</span></a>
  </div>
</div>
<div class="line10"></div>
<!--/导航栏-->

<!--内容-->
<div id="floatHead" class="content-tab-wrap">
  <div class="content-tab">
    <div class="content-tab-ul-wrap">
      <ul>
        <li><a class="selected" href="javascript:;">基本信息</a></li>
      </ul>
    </div>
  </div>
</div>

<div class="tab-content">
   <dl>
    <dt>上级导航</dt>
    <dd>
      <div class="rule-single-select">
          @{ 
              int selectid = m.parent_id;
              if (m.parent_id == 0)
                  selectid = Convert.ToInt32(ViewBag.Id);
          }
        @if(m.is_sys == 1){
           @Html.DropDownList("ddlParentId", new SelectList(parentList, "Value", "Text", selectid.ToString()), new { disabled = "disabled" })
        }
         else{
           @Html.DropDownList("ddlParentId", new SelectList(parentList, "Value", "Text", selectid.ToString()))
        }
      </div>
    </dd>
  </dl>
  <dl>
    <dt>排序数字</dt>
    <dd>
      @Html.TextBox("txtSortId", m.sort_id.ToString(), new { @class="input small", datatype="n", sucmsg=" "})
      <span class="Validform_checktip">*数字，越小越向前</span>
    </dd>
  </dl>
  <dl>
    <dt>是否隐藏</dt>
    <dd>
      <div class="rule-single-checkbox">
          @Html.CheckBox("cbIsLock", m.is_lock == 1)
      </div>
      <span class="Validform_checktip">*隐藏后不显示在界面导航菜单中。</span>
    </dd>
  </dl>
  <dl>
    <dt>调用别名</dt>
    <dd>
      @Html.TextBox("txtName", m.name, new { @class="input normal", datatype=@"/^[a-zA-Z0-9\-\_]{2,50}$/", errormsg="请填写正确的ID", sucmsg=" "})
      <span class="Validform_checktip">权限控制名称，只允许字母、数字、下划线</span>
    </dd>
  </dl>
  <dl>
    <dt>导航标题</dt>
    <dd>
       @Html.TextBox("txtTitle", m.title, new { @class="input normal", datatype="*1-100", sucmsg=" "})
       <span class="Validform_checktip">*导航中文标题，100字符内</span>
    </dd>
  </dl>
  <dl>
    <dt>副标题</dt>
    <dd>
      @Html.TextBox("txtSubTitle", m.sub_title, new { @class="input normal", datatype="*0-100", sucmsg=" "})
      <span class="Validform_checktip">非必填，当导航拥有两个名称时使用</span>
    </dd>
  </dl>
  <dl>
    <dt>自定义图标</dt>
    <dd>
      @Html.TextBox("txtIconUrl", m.icon_url, new { @class="input normal upload-path", maxlength="255"})
      <div class="upload-box upload-img"></div>
      <span class="Validform_checktip">非必填，可上传图片或以“.”开头填写CSS名称</span>
    </dd>
  </dl>
  <dl>
    <dt>链接地址</dt>
    <dd>
      @Html.TextBox("txtLinkUrl", m.link_url, new { @class="input normal", maxlength="255"})
      <span class="Validform_checktip">当前管理目录，有子导航不用填</span>
    </dd>
  </dl>
  <dl>
    <dt>备注说明</dt>
    <dd>
      @Html.TextArea("txtRemark", m.remark, new { @class="input"})
      <span class="Validform_checktip">非必填，可为空</span>
    </dd>
  </dl>
  <dl>
    <dt>权限资源</dt>
    <dd>
      <div class="rule-multi-porp">
         @foreach (KeyValuePair<string, string> kv in Utils.ActionType()) {
            @Html.CheckBox("cblActionType_" + kv.Key, m.action_type.ToLower().IndexOf(kv.Key.ToLower()) >= 0)
            @Html.Label(kv.Value + "(" + kv.Key + ")",kv.Value + "(" + kv.Key + ")", new { @for = "cblActionType_" + kv.Key})
         }
      </div>
    </dd>
  </dl>
</div>
<!--/内容-->

<!--工具栏-->
<div class="page-footer">
  <div class="btn-wrap">
    <input type="submit" class="btn" value="提交保存" />
    <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript:history.back(-1);" />
  </div>
</div>
<!--/工具栏-->
</form>
